{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ee335105-d971-4641-9f02-b74b16ab2d61",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "%goflags=[\"--cover\" \"--covermode=set\"]\n"
     ]
    }
   ],
   "source": [
    "%goflags --cover --covermode=set"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "8278e544-c48b-4f34-a151-9b58ac31ae19",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hello World!\n"
     ]
    }
   ],
   "source": [
    "// Package abc is ignored by GoNB. It always use \"package main\" to execute the cell.\n",
    "package abc\n",
    "\n",
    "%%\n",
    "fmt.Println(\"Hello World!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "621d6604-e016-40a9-9ccd-734747e70187",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Works with //gonb:\n"
     ]
    }
   ],
   "source": [
    "// Make sure the //gonb: prefix will work as well.\n",
    "//gonb:%%\n",
    "fmt.Println(\"Works with //gonb:\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "bfdcc7f3-a282-4db9-a0dd-e8e58362fd9e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Got x=17\n"
     ]
    }
   ],
   "source": [
    "// Test flags\n",
    "var x = flag.Int(\"x\", 0, \"value of x to feed f()\")\n",
    "\n",
    "func f() {\n",
    "    fmt.Printf(\"Got x=%d\\n\", *x)\n",
    "}\n",
    "\n",
    "%% -x=17\n",
    "f()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "748bf745-247f-4c94-90d2-07dc68cd7dd5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Got x=13\n"
     ]
    }
   ],
   "source": [
    "// Test %exec\n",
    "\n",
    "//gonb:%exec f -x=13"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Go (gonb)",
   "language": "go",
   "name": "gonb"
  },
  "language_info": {
   "codemirror_mode": "",
   "file_extension": ".go",
   "mimetype": "text/x-go",
   "name": "go",
   "nbconvert_exporter": "",
   "pygments_lexer": "",
   "version": "go1.25.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
